class Solution
{
public:
    vector<int> statisticalResult(vector<int>& a)
    {
        int n = a.size();
        if (n == 0)
            return {};

        vector<int> ans(n, 1);
        for (int i = 1; i < n; i++)
            ans[i] = ans[i - 1] * a[i - 1];

        int t = 1;
        for (int i = n - 2; i >= 0; i--)
        {
            t *= a[i + 1];
            ans[i] *= t;
        }

        return ans;
    }
};